package com.sanyang.pda.ui.manualpallet;

import android.os.Bundle;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.fragment.app.Fragment;
import androidx.viewpager.widget.ViewPager;

import com.alibaba.android.arouter.facade.annotation.Route;
import com.ogaclejapan.smarttablayout.SmartTabLayout;
import com.sanyang.pda.adapter.MyTitleViewPagerAdapter;
import com.sanyang.pda.utils.StringConfig;
import com.wangshen.base.app.AppActivityKey;
import com.wangshen.base.ui.mvp.base.ui.BaseActivity;
import com.wangshen.projectbase.R;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.OnClick;

@Route(path = AppActivityKey.MANUALPALLETDETAILACTIVITY)
public class ManualPalletDetailActivity extends BaseActivity {
    @BindView(R.id.iv_back)
    ImageView ivBack;
    @BindView(R.id.tv_title)
    TextView tvTitle;
    @BindView(R.id.tv1)
    TextView tv1;
    @BindView(R.id.title)
    FrameLayout title;
    @BindView(R.id.smart)
    SmartTabLayout smart;
    @BindView(R.id.vp_content)
    ViewPager vpContent;
    private List<Fragment> fragments = new ArrayList<>();
    private List<String> titleList = new ArrayList<>();
    private MyTitleViewPagerAdapter myTitleViewPagerAdapter;
    @Override
    public int getView() {
        return R.layout.activity_manual_pallet_detail;
    }

    @Override
    public void initView() {
        myTitleViewPagerAdapter = new MyTitleViewPagerAdapter(getSupportFragmentManager(), fragments, titleList);
        vpContent.setAdapter(myTitleViewPagerAdapter);
        vpContent.setOffscreenPageLimit(3);
        smart.setViewPager(vpContent);
    }

    @Override
    public void initLinsenterner() {

    }

    @Override
    public void getData() {
        Bundle bundle=getIntent().getExtras();
        String en=bundle.getString(StringConfig.ENTRYNO);
        tv1.setText(en);
        fragments.add(new CheckFragment(en));
        fragments.add(new PalletStatisticsFragment(en));
        fragments.add(new PalletDetailFragment(en));
        titleList.add(getResources().getString(R.string.check));
        titleList.add(getResources().getString(R.string.statistics));
        titleList.add(getResources().getString(R.string.detail));
    }



    @OnClick(R.id.iv_back)
    public void onViewClicked() {
        finish();
    }
}
